package gallery.imageviewer.asset
{

    import flash.display.Bitmap;
    import flash.display.Shape;
    import mx.controls.Image;
    import mx.events.*;
    import mx.graphics.RectangularDropShadow;


    
    [Style(name="frameColor", type="uint", format="color", inherit="no")]
    [Style(name="frameThickness", type="Number", format="Length", inherit="no")] 
    [Style(name="frameSize", type="Number", format="Length", inherit="no")]
    
    
    [Style(name="borderColor", type="uint", format="Color", inherit="no")]
	[Style(name="borderThickness", type="Number", format="Length", inherit="no")]
	[Style(name="borderAlpha", type="Number", format="Length", inherit="no")]


    public class ImageHolder extends Image
    {

        public function ImageHolder()
        {
            super();
            
        }

        override protected function createChildren():void
        {
            super.createChildren();
            super.setStyle("verticalAlign", "middle");
            super.setStyle("horizontalAlign", "center");
            
        }

        override public function set width(value:Number):void
        {
            super.width = value;
        }

        override public function get width():Number
        {
            return super.width;
        }

        override public function set height(value:Number):void
        {
            super.height = value;
        }

        override public function get height():Number
        {
            return super.height;
        }

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
        {
            super.updateDisplayList(unscaledWidth, unscaledHeight);
            //var frameColor:uint = getStyle("frameColor");
            //var frameThickness:Number = getStyle("frameThickness");
            //var frameSize:Number = getStyle("frameSize");
			/*
            //draw the four corners
            if (frameThickness > 0)
            {
                var g:Graphics = graphics;
                g.clear();
                g.lineStyle(frameThickness, frameColor, 1);

                //upper left corner
                g.moveTo(0, frameSize);
                g.lineTo(0, 0);
                g.lineTo(frameSize, 0);

                //lower left corner
                g.moveTo(0, unscaledHeight - frameSize);
                g.lineTo(0, unscaledHeight);
                g.lineTo(frameSize, unscaledHeight);

                //upper right corner
                g.moveTo(unscaledWidth - frameSize, 0);
                g.lineTo(unscaledWidth, 0);
                g.lineTo(unscaledWidth, frameSize);

                //lower right corner
                g.moveTo(unscaledWidth, unscaledHeight - frameSize);
                g.lineTo(unscaledWidth, unscaledHeight);
                g.lineTo(unscaledWidth - frameSize, unscaledHeight);
            }*/
			
			/*
			x+=(getStyle('borderThickness')/2);
			y+=(getStyle('borderThickness')/2);
			graphics.lineStyle(getStyle('borderThickness'),getStyle('borderColor'),getStyle('borderAlpha'),false);
			graphics.drawRect(-(getStyle('borderThickness')/2),-(getStyle('borderThickness')/2),contentWidth+getStyle('borderThickness'),contentHeight+getStyle('borderThickness'));
			*/
        }

    }
}